package com.microservice.springcloud.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.microservice.springcloud.entity.User;

@RestController
public class WebController {
	
	@Autowired
	private RestTemplate restTemplate;
	
	@GetMapping("/getUserById/{id}")
	public User getUserById(@PathVariable Long id) {
		User user = restTemplate.getForObject("http://microservice-springcloud-privider/getUserById/" + id, User.class);
		return user;
	}
}
